package dkbta.ontology.elements.abstractions.gradient;

import java.sql.PreparedStatement;
import java.sql.SQLException;

import dkbta.ontology.elements.ElementType;
import dkbta.ontology.elements.abstractions.Abstraction;
import dkbta.util.time.TimeInterval;

public class Gradient extends Abstraction{
	/**
	 * Initializes a gradient instance with the given parameters
	 * 
	 * @param name The element's name
	 * @param startTime The element's start time
	 * @param endTime The element's end time
	 * @param value The value of the gradient
	 */
	public Gradient(String name, long startTime, long endTime, Object value){
		super(ElementType.GRADIENT, name, startTime, endTime, value);
	}

	/**
	 * Initializes a gradient instance with the given parameters
	 * 
	 * @param name The element's name
	 * @param timeInterval The time interval
	 * @param value The value of the gradient
	 */
	public Gradient(String name, TimeInterval timeInterval, Object value){
		super(ElementType.GRADIENT, name, timeInterval, value);
	}

	@Override
	public void insertDataIntoPS(PreparedStatement ps, int valueIndex, int typeIndex)
			throws SQLException{
		String value = "SAME";
		if ("Increasing".equalsIgnoreCase((String)_value)){
			value = "INC";
		}else if ("Decreasing".equalsIgnoreCase((String)_value)){
			value = "DEC";
		}
		ps.setString(valueIndex, value);
		ps.setString(typeIndex, "GRADIENT");
	}
}
